package com.bunkerdev.mymo;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import android.media.MediaPlayer;

public class ReproductorImpl implements Reproductor{

	private MediaPlayer reproductor;

	public ReproductorImpl(String ruta){
		try {
			
			reproductor= new MediaPlayer();
			//FileInputStream finmput;
			//finmput = new FileInputStream(new File(ruta));
			reproductor.setDataSource(ruta);
			reproductor.prepare();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}



	}
	
	public Boolean play(){
		Boolean res=false;
		if(!reproductor.isPlaying()){
			reproductor.start(); 
			res=false;
		}
		return res;		
	}
	
	public Integer getPosition(){
		return reproductor.getCurrentPosition();
	}
}
